<template>
	<view class="bg-white">
		<mescroll-body ref="mescrollRef" :bottombar="false" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<view class="bg position-relative"  :style="{ background: 'url('+$_BASE_IMG_API+'/images/integralbg.png)  no-repeat','background-size': '100% 100%'}">
				<view class="position-relative flex flex-column align-center u-p-t-30">
				<text class="u-p-t-30 u-font-30" style="color:#f3e9db">股票金额数</text>
					<text class="u-p-t-30 font-weight-bold u-font-40 text-white">{{userInfo.credit6 || '0.00'}}</text>
				</view>
			</view>
			<view class="u-m-t-40 u-m-l-30 font-32 font-weight-bold" style="color:#333333">
				股票金额数明细
			</view>
			<view class="u-m-t-20 rounded-10"  v-if="infoList.length>0">
				<view class="u-p-x-30 u-p-y-20 bg-white" >
					<block v-for="(item,index) in infoList" :key="index">
						<view class="flex align-center justify-between u-p-y-20 u-border-bottom">
							<view class="flex flex-column" style="width: 80%;">
								<text>{{item.remark}}</text>
								<text class="text-greey u-p-t-20">{{item.createtime}}</text>
							</view>
							<text>{{item.num}}</text>
						</view>
					</block>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import { MineCenterApi } from '@/api/serves.js'
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				infoList: [],
			}
		},
		onLoad() {

		},
		methods: {
			// 下拉刷新回掉
			downCallback() {
				this.mescroll.resetUpScroll() 
			},
			// 上拉加载
			upCallback(page) {
				MineCenterApi.Ccdetails({type: 6, page: page.num}).then(res=> {
					console.log('积分明细', res);
					if(res.code == 1){
						let result = res.data
						if(page.num == 1) this.infoList = []; //如果是第一页需手动制空列表
						this.infoList = this.infoList.concat(result); //追加新数据
						setTimeout(()=>{
							this.mescroll.endByPage(result.length, result.totalpage)
							uni.hideLoading();
						},20)
					}else {
						this.$Toast(res.msg)
						this.mescroll.endErr()
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.bg {
	width: 750rpx;
	height: 250rpx;
}
</style>
